home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.5 Complementary Applications 2004 February / SGI IRIX 6.5 Complementary Applications 2004 February.iso / dist / cde.idb / usr / dt / share / examples / motif / draganddrop / DNDDemo.h.z / DNDDemo.h
Encoding:
C/C++ Source or Header  |  2003-11-18  |  8.1 KB  |  243 lines

  1. /*
  2.  * DNDDemo.h
  3.  *
  4.  * Copyright 2000, Silicon Graphics, Inc.
  5.  * ALL RIGHTS RESERVED
  6.  * 
  7.  * UNPUBLISHED -- Rights reserved under the copyright laws of the United
  8.  * States.   Use of a copyright notice is precautionary only and does not
  9.  * imply publication or disclosure.
  10.  *
  11.  * U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND:
  12.  * Use, duplication or disclosure by the Government is subject to restrictions
  13.  * as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights
  14.  * in Technical Data and Computer Software clause at DFARS 252.227-7013 and/or
  15.  * in similar or successor clauses in the FAR, or the DOD or NASA FAR
  16.  * Supplement.  Contractor/manufacturer is Silicon Graphics, Inc.,
  17.  * 2011 N. Shoreline Blvd. Mountain View, CA 94039-7311.
  18.  *
  19.  * THE CONTENT OF THIS WORK CONTAINS CONFIDENTIAL AND PROPRIETARY
  20.  * INFORMATION OF SILICON GRAPHICS, INC. ANY DUPLICATION, MODIFICATION,
  21.  * DISTRIBUTION, OR DISCLOSURE IN ANY FORM, IN WHOLE, OR IN PART, IS STRICTLY
  22.  * PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF SILICON
  23.  * GRAPHICS, INC.
  24.  */
  25. /* 
  26.  * (c) Copyright 1989, 1990, 1991, 1992, 1993 OPEN SOFTWARE FOUNDATION, INC. 
  27.  * ALL RIGHTS RESERVED 
  28. */ 
  29. /* 
  30.  * Motif Release 1.2.2
  31. */ 
  32. /*   $XConsortium: DNDDemo.h /main/cde1_maint/1 1995/07/14 13:58:57 drk $ */
  33. /*
  34. *  (c) Copyright 1987, 1988, 1989 HEWLETT-PACKARD COMPANY */
  35. /*
  36.  *    file: DNDDemo.h
  37.  *
  38.  *    Header file for the program DNDDemo.
  39.  */
  40.  
  41. #include <stdio.h>
  42. #include <X11/Xatom.h>
  43. #include <X11/Intrinsic.h>
  44. #include <Xm/Xm.h>
  45. #include <Xm/AtomMgr.h>
  46. #include <Xm/MainW.h>
  47. #include <Xm/DrawingA.h>
  48. #include <Xm/SeparatoG.h>
  49. #include <Xm/Form.h>
  50. #include <Xm/RowColumn.h>
  51. #include <Xm/PushB.h>
  52. #include <Xm/MessageB.h>
  53. #include <Xm/DragDrop.h>
  54. #include <Xm/Screen.h>
  55.  
  56.  
  57. /* The following is used to layout the color labels */
  58. #define BOX_WIDTH       85
  59. #define BOX_HEIGHT      25
  60. #define BOX_X_OFFSET    95
  61. #define BOX_Y_OFFSET    35
  62. #define BOX_X_MARGIN    10
  63. #define BOX_Y_MARGIN    10
  64.  
  65. /* The following are used in setting up the drag icons */
  66. #define ICON_WIDTH          32
  67. #define ICON_HEIGHT         32
  68. #define SMALL_ICON_WIDTH    16
  69. #define SMALL_ICON_HEIGHT   16
  70. #define ICON_X_HOT          0
  71. #define ICON_Y_HOT          0
  72.  
  73. /* Some scales or text entry field could be added to change this value */
  74. #define RECT_WIDTH  20
  75. #define RECT_HEIGHT 50
  76.  
  77. /* The following defines could be setup as application resources */
  78. #define RECT_START_COLOR    "black"
  79. #define HIGHLIGHT_THICKNESS 3
  80. #define HIGHLIGHT_COLOR     "Black"   /* this is equivalent to gray60
  81.                                          in the R5 rgb.txt */
  82. #define DRAW_AREA_BG_COLOR "white"
  83. #define DRAW_AREA_FG_COLOR "black"     /* 5127 fix */
  84. #define LABEL1_COLOR       "#ff5026"     /* a slight softer shade of red,
  85.                                             red was too dark */
  86. #define LABEL2_COLOR    "orange"
  87. #define LABEL3_COLOR    "yellow"
  88. #define LABEL4_COLOR    "violet"
  89. #define LABEL5_COLOR    "#00C3ff"           /* a blue green color,
  90.                                                blue was too dark */
  91. #define LABEL6_COLOR    "green"
  92.  
  93. #define VALID_CURSOR_FG_COLOR   "black"
  94. #define INVALID_CURSOR_FG_COLOR "maroon"
  95. #define NONE_CURSOR_FG_COLOR    "maroon"
  96.  
  97.  
  98. /*
  99.  * This struct is used to contain information about each rectangle 
  100.  * to use in the dislay routines
  101.  */
  102. typedef struct _RectStruct {
  103.     Position x;
  104.     Position y;
  105.     Dimension width;
  106.     Dimension height;
  107.     Pixel color;
  108.     Pixmap pixmap;   /* currently not in use */
  109. } RectStruct, *RectPtr;
  110.  
  111. /* This struct is used to hold global application information */
  112. typedef struct _AppInfoRec {
  113.     GC rectGC;              /* graphic context used to draw the rectangles */
  114.     Pixel currentColor;     /* color that is currently in the GC */
  115.     RectPtr *rectDpyTable;  /* the rectangle display table */
  116.     int rectsAllocd;        /* keeps track of how much the above
  117.                                table has been alloc'd */
  118.     int numRects;           /* the number of rects that are visible */
  119.     RectPtr highlightRect;  /* the current highlighted rectangle */
  120.     RectPtr clearRect;      /* the rectangle that is being moved */
  121.     Boolean doMove;         /* indicates that a move is being performed */
  122.     Boolean creatingRect;   /* indicates that a rect create is being 
  123.                                performed */
  124.     unsigned char operation;/* indicates the drop help operation */
  125.     unsigned int maxCursorWidth;  /* the maximum allowable cursor width */
  126.     unsigned int maxCursorHeight; /* the maximum allowable cursor height */
  127.     Position rectX;
  128.     Position rectY;
  129.     Position rectX2;
  130.     Position rectY2;
  131. } AppInfoRec, *AppInfo;
  132.  
  133. /*
  134.  * This struct is used to pass information
  135.  * from the dropProc to the transferProc
  136.  */
  137. typedef struct _DropTransferRec {
  138.     Widget widget;
  139.     Position x;
  140.     Position y;
  141. } DropTransferRec, *DropTransfer;
  142.  
  143. /*
  144.  * This struct is used to pass information
  145.  * from the rectangle dragStart proc to it's associated
  146.  * callback procs.
  147.  */
  148. typedef struct _DragConvertRec {
  149.     Widget widget;
  150.     RectPtr rect;
  151. } DragConvertRec, *DragConvertPtr;
  152.  
  153.  
  154. #ifdef _NO_PROTO
  155.  
  156. extern void     InitializeAppInfo();
  157. extern void     StartRect();
  158. extern void     ExtendRect();
  159. extern void     EndRect();
  160. extern RectPtr  RectCreate();
  161. extern RectPtr  RectFind();
  162. extern void     RectSetColor();
  163. extern Pixel    RectGetColor();
  164. extern Pixmap   GetBitmapFromRect();
  165. extern void     RectHide();
  166. extern void     RectFree();
  167. extern void     RedrawRectangles();
  168. extern void     RectDrawStippled();
  169. extern void     RectHighlight();
  170. extern void     RectUnhighlight();
  171. extern void     RectSetPixmap();
  172. extern void     RectRegister();
  173. extern void     InitializeRectDpyTable();
  174. extern void     CreateLayout();
  175. extern void     CreateRectGC();
  176. extern Pixel    GetColor();
  177. extern void     ColorRect();
  178.  
  179. #else
  180.  
  181. extern void     InitializeAppInfo(void );
  182. extern void     StartRect(Widget , XEvent *, String *, Cardinal *);
  183. extern void     ExtendRect(Widget , XEvent *, String *, Cardinal *);
  184. extern void     EndRect(Widget , XEvent *, String *, Cardinal *);
  185. extern RectPtr  RectCreate(Position , Position , Dimension ,
  186.                           Dimension , Pixel , Pixmap );
  187. extern RectPtr  RectFind(Position , Position );
  188. extern void     RectSetColor(RectPtr , Display *, Window , Pixel );
  189. extern Pixel    RectGetColor(RectPtr );
  190. extern Pixmap   GetBitmapFromRect(Widget , RectPtr , Pixel , Pixel ,
  191.                                   Dimension *, Dimension *);
  192. extern void     RectHide(Display *, Window , RectPtr );
  193. extern void     RectFree(RectPtr );
  194. extern void     RedrawRectangles(Widget );
  195. extern void     RectDrawStippled(Display *, Window , RectPtr );
  196. extern void     RectHighlight(Widget , RectPtr );
  197. extern void     RectUnhighlight(Widget );
  198. extern void     RectSetPixmap(RectPtr , Display *, Window , Pixmap );
  199. extern void     RectRegister(RectPtr , Position , Position );
  200. extern void     InitializeRectDpyTable(void );
  201. extern void     CreateLayout(void );
  202. extern void     CreateRectGC(void );
  203. extern Pixel    GetColor(char *);
  204. extern void     ColorRect(Widget , XEvent *, String *, Cardinal *);
  205.  
  206. #endif    /* _NO_PROTO */
  207.  
  208.  
  209. /* The following character arrays hold the bits for
  210.  * the source and state icons for both 32x32 and 16x16 drag icons.
  211.  * The source is a color palatte icon and the state is a paint brush icon.
  212.  */
  213. extern unsigned char SOURCE_ICON_BITS[];
  214. extern unsigned char SOURCE_ICON_MASK[];
  215. extern unsigned char STATE_ICON_BITS[];
  216. extern unsigned char STATE_ICON_MASK[];
  217. extern unsigned char INVALID_ICON_BITS[];
  218. extern unsigned char SMALL_SOURCE_ICON_BITS[];
  219. extern unsigned char SMALL_SOURCE_ICON_MASK[];
  220. extern unsigned char SMALL_STATE_ICON_BITS[];
  221. extern unsigned char SMALL_STATE_ICON_MASK[];
  222. extern unsigned char SMALL_INVALID_ICON_BITS[];
  223.  
  224. /* The folowing character arrays are for use with the drop help
  225.  * dialogs.  For internationalization, message catalogs should
  226.  * replace these static declarations.
  227.  */
  228. extern char HELP_MSG1[];
  229. extern char HELP_MSG2[];
  230. extern char HELP_MSG3[];
  231. extern char HELP_MSG4[];
  232. extern char HELP_MSG5[];
  233.  
  234.  
  235. /* Globals variables */
  236. extern AppInfo      appInfo;
  237. extern Widget       topLevel;
  238. extern Widget       drawingArea;
  239. extern Widget       helpDialog;
  240. extern Widget       helpLabel, helpMenu;
  241. extern XtAppContext appContext;
  242.  
  243.